package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * @date 2025年02月18日
 */
public class Emp implements CompareInterface<Emp> {

    private String name;
    private double salary;

    public Emp(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public int compareTo(Emp emp) {
        if (this.getSalary() > emp.getSalary()) {
            return 1;
        } else if (this.getSalary() < emp.getSalary()) {
            return -1;
        }
        return 0;
    }
}
